package com.ssm.controller.student;

import com.alibaba.fastjson.JSONObject;
import com.ssm.controller.BaseController;
import com.ssm.entity.RecruitInfo;
import com.ssm.service.NoticeListService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@Controller
public class NoticeController extends BaseController {
    @Resource(name = "noticeList")
    private NoticeListService noticeListService;
    // 查询
    @RequestMapping(value ="student/notice",method = RequestMethod.GET)
    public String NoticeQuery(HttpSession session, Map<String,Object> map){
        List<RecruitInfo> recruitInfos=new ArrayList<>();
        logger.info("检查学生权限");
        String adminId=checkAdmin(session);
        if (!adminId.equals("studentId")){
            return "redirect:/";
        }
        recruitInfos=noticeListService.listAllNoticeList();
        map.put("recruitInfos",recruitInfos);
        for (int i = 0; i < recruitInfos.size(); i++) {
            logger.info(recruitInfos.get(i));
        }
        return "student/notice";
    }

}
